#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <time.h>
#include "Objet.h"


// Mutateur

void setTypeObjet(Objet *Obj, typeObjet type)
{
    Obj->type = type;
}
void setNom (Objet *Obj, char nom[100])
{
    strcpy(Obj->nom ,nom);
}
void setDegats(Objet *Obj, int degats)
{
    Obj->degats = degats;
}
void setArmure(Objet *Obj, int armure)
{
    Obj->armure = armure;
}
void setNiveau(Objet *Obj, int niveau)
{
    Obj->niveau = niveau;
}
void setPrix(Objet *Obj, int prix)
{
    Obj->prix = prix;
}
void setPortee(Objet *Obj, int portee)
{
    Obj->portee = portee;
}
void setBonus(Objet *Obj, Bonus bon)
{
    Obj->bon = bon;
}
void setRestauration(Objet *Obj,Restauration rest)
{
    Obj->rest = rest;
}

// Accesseur

typeObjet getTypeObjet(const Objet *Obj)
{
    return Obj->type;
}
const char* getNom(const Objet *Obj)
{
    return Obj->nom;
}
int getDegats(const Objet *Obj)
{
    return Obj->degats;
}
int getArmure(const Objet *Obj)
{
    return Obj->armure;
}
int getNiveau(const Objet *Obj)
{
    return Obj->niveau;
}
int getPrix(const Objet *Obj)
{
    return Obj->prix;
}
int getPortee(const Objet *Obj)
{
    return Obj->portee;
}
Bonus* getBonus(Objet *Obj)
{
    return &Obj->bon;
}
Restauration* getRestauration(Objet *Obj)
{
    return &Obj->rest;
}

void initObj(Objet* Obj)
{
    Obj->type = RIEN;
    Obj->degats = NULL;
    Obj->armure = NULL;
    Obj->niveau = NULL;
    Obj->prix = NULL;
    Obj->portee = NULL;
    Obj->bon.typeBonus = AUCUN;
    Obj->rest.typeRest = AUCUN;
    Obj->bon.valeur = NULL;
    Obj->rest.valeur = NULL;
}

void initObj(Objet *Obj , typeObjet type , char nom[100] = NULL , int degats = 0, int armure = 0, int niveau = 0,int prix = 0, int portee = 0)
{
    Obj->type = type;
    strcpy(Obj->nom ,nom);
    Obj->degats = degats;
    Obj->armure = armure;
    Obj->niveau = niveau;
    Obj->prix = prix;
    Obj->portee = portee;

}

void initObj(Objet *Obj , typeObjet type , char nom[100], int degats, int armure, int niveau, int prix,  int portee, Bonus bon, Restauration rest )
{
    Obj->type = type;
    strcpy(Obj->nom ,nom);
    Obj->degats = degats;
    Obj->armure = armure;
    Obj->niveau = niveau;
    Obj->portee = portee;
    Obj->bon = bon;
    Obj->rest = rest;
}

void AffecteObjet (Objet *Obj1 , Objet *Obj2)
{
    Obj1->type = Obj2->type;
    strcpy(Obj1->nom ,Obj2->nom);
    Obj1->degats = Obj2->degats;
    Obj1->armure = Obj2->armure;
    Obj1->niveau = Obj2->niveau;
    Obj1->portee = Obj2->portee;
    Obj1->bon.typeBonus = Obj2->bon.typeBonus;
    Obj1->bon.valeur = Obj2->bon.valeur;
    Obj1->rest.typeRest= Obj2->rest.typeRest;
    Obj1->rest.valeur = Obj2->rest.valeur;
}


